<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
  <button id="btn1" >切换</button>
  <input type="text" placeholder="输入内容">
  <input type="checkbox" placeholder="输入内容" id="one">

    <script>
        //获取按钮元素
        var btn1 = document.getElementById("btn1");
        //获取input元素
        var input1 = document.getElementsByTagName("input")[0];
        //获取checkbox元素
        var checkbox1 = document.getElementById("one");
console.dir(btn1);
console.dir(input1);

var flag = true;

btn1.onclick = function(){
    if(flag){
        //占位符
    input1.placeholder= "禁用";
    input1.disabled = true;
    flag = false;
    checkbox1.checked = true;
}else{
    input1.placeholder = "输入内容";
    input1.disabled = false;
    flag = true;
    checkbox1.checked = false;
}
}

    </script>
</body>
</html>